package com.example.controller.shenhe;

import com.example.pojo.CourseRecord;
import com.example.service.shenhe.Shproductservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;

/**
 * @ClassName: ***
 * @Description: ***
 * @author: ***
 * @date: 2022/12/20 15:01
 */
@Controller
@RequestMapping("product")
public class Shproductcontroller {
    @Autowired
    private Shproductservice shproductservice;

    /**
    * @Author: zdp
    * @Description: 查询分类表
    * @DateTime: 15:02 2022/12/20
    * @Params:
    * @Return
    */
    @ResponseBody
    @PostMapping("/all")
    public List all(){
        return shproductservice.all();
    }

    /**
    * @Author: zdp
    * @Description: 分类
    * @DateTime: 19:04 2022/12/20
    * @Params:
    * @Return
    */
    @ResponseBody
    @PostMapping("/productclass")
    public List productclass(){
        return shproductservice.productclass();
    }

    /**
    * @Author: zdp
    * @Description: 模糊查
    * @DateTime: 10:09 2022/12/21
    * @Params:
    * @Return
    */
    @ResponseBody
    @PostMapping("/mohucha")
    public List mo(String productName, String categroyId, BigDecimal currentpriceProduct){
        System.out.println(productName);
        System.out.println(categroyId);
        System.out.println(currentpriceProduct);
        return shproductservice.mo(productName,categroyId,currentpriceProduct);
    }
    /**
     * @Author: zdp
     * @Description: 审核商品，修改商品审核状态、添加审核记录表
     * @DateTime: 11:58 2022/12/16
     * @Params:
     * @Return
     */
    @ResponseBody
    @RequestMapping("/shenhe")
    public int shenhe(CourseRecord courseRecord){
        int shenhe = shproductservice.shenhe(courseRecord);
        return shenhe;
    }

    /**
    * @Author: zdp
    * @Description: 批量审核，修改
    * @DateTime: 13:34 2023/2/1
    * @Params:
    * @Return
    */
    @ResponseBody
    @RequestMapping("/piliang")
    public int piliang(@RequestParam("piliangid")List<Integer> s1,@RequestParam("jieguo")int jie){
        int piliang = shproductservice.piliang(s1, jie);
        return piliang;
    }
}
